import request from "@/utils/request";


/**
 * 获取信息
 * @param id 项目id
 */
export function getInfo(id) {
    return request({
        url: '/core/fias/v1/' + id,
        method: 'get'
    });
}

/**
 * 点击下一步
 * @param data 参数
 */
export function fiasConfig(data) {
    return request({
        url: '/core/fias/fiasConfig',
        method: 'post',
        data: data,
    });
}

/**
 * 添加FIAS的大类
 */
export const addFIASCategory = (data) => {
    return request({
        url: '/core/fiasCategory/front',
        method: 'post',
        data: data
    });
};

/**
 * 查看FIAS的大类
 */
export const list = (id) => {
    return request({
        url: '/core/fiasCategory/list/'+id,
        method: 'get',
    });
};

/**
 * 删除FIAS的大类
 */
export const deleteFIAS = (id) => {
    return request({
        url: '/core/fiasCategory/front/'+id,
        method: 'delete',
    });
};

/**
 * 查看FIAS的分类详情
 */
export const detail = (id) => {
    return request({
        url: '/core/fiasCategory/front/detail/'+id,
        method: 'get',
    });
};

/**
 * 添加FIAS的小类
 */
export const addFIASClass = (data) => {
    return request({
        url: '/core/fiasClass/front',
        method: 'post',
        data: data
    });
};

/**
 * 删除FIAS的编码
 */
export const deleteFIASClass = (id) => {
    return request({
        url: '/core/fiasClass/front/'+id,
        method: 'delete',
    });
};

/**
 * 前一步(to Upload)
 * @param id
 * @returns {Promise<AxiosResponse<any>> | *}
 */
export function preUpload(id){
    return request({
        url:'/core/fias/preUpload/'+id,
        method: 'put',
    })
}

/**
 * 后一步(to encode)
 * @param id
 * @returns {Promise<AxiosResponse<any>> | *}
 */
export function nextToEncode(id){
    return request({
        url:'/core/fias/nextToEncode/'+id,
        method:'put'
    })
}

/**
 * 查看FIAS的级联编码
 */
export const cascader = (id) => {
    return request({
        url: '/core/fiasCategory/front/cascader/'+id,
        method: 'get',
    });
};

/**
 * 根据id获取编码的num
 */
export const getCodeNum = (id) => {
    return request({
        url: '/core/fiasClass/front/'+id,
        method: 'get',
    });
};

/**
 * 执行fias分析
 * @param id 分析id
 * @param data 分析编码列表
 * @returns {Promise<AxiosResponse<any>> | *}
 */
export function encodeFias(id,data) {
    return request({
        url: '/core/fias/encode/'+ id,
        method: 'post',
        data:data,
    });
}

/**
 * 查看FIAS的穿梭框编码
 */
export const transfer = (id) => {
    return request({
        url: '/core/fiasCategory/front/transfer/'+id,
        method: 'get',
    });
};

/**
 * 添加折线
 */
export const polyline = (data) => {
    return request({
        url: '/core/fias/front/polyline',
        method: 'post',
        data: data
    });
};

/**
 * 获取折线
 */
export const getPolyline = (id) => {
    return request({
        url: '/core/fias/front/polyline/'+id,
        method: 'get'
    });
};

/**
 * 获取折线信息
 */
export const getPolylineInfo = (id) => {
    return request({
        url: '/core/fiasPolyline/front/polylineInfo/'+id,
        method: 'get'
    });
};

/**
 * 删除折线
 */
export const deletePolyline = (id) => {
    return request({
        url: '/core/fiasPolyline/front/'+id,
        method: 'delete'
    });
};

/**
 * 后一步(to download)
 * @param id
 * @returns {Promise<AxiosResponse<any>> | *}
 */
export function nextToDownload(id){
    return request({
        url:'/core/fias/nextToDownload/'+id,
        method:'put'
    })
}

/**
 * 前一步(to result)
 * @param id
 * @returns {Promise<AxiosResponse<any>> | *}
 */
export function preToPolyline(id){
    return request({
        url:'/core/fias/preToPolyline/'+id,
        method:'put'
    })
}

/**
 * 获取雷达图
 */
export const getRadar = (id) => {
    return request({
        url: '/core/fias/front/radar/'+id,
        method: 'get'
    });
};

/**
 * 获取分析结果
 */
export const result = (id) => {
    return request({
        url: '/core/fias/front/result/'+id,
        method: 'get'
    });
};